package org.dreamwork.jasmine2.restful.client.gui.model;

import org.dreamwork.jasmine2.restful.MethodDefinition;

import javax.swing.tree.DefaultMutableTreeNode;

/**
 * Created by IntelliJ IDEA.
 * User: seth.yang
 * Date: 2014/12/9
 * Time: 1:20
 */
public class MethodTreeNode extends DefaultMutableTreeNode {
    private MethodDefinition md;
    public MethodTreeNode () {
        super ();
    }

    public MethodTreeNode (MethodDefinition md) {
        super (md.getTitle ());
        this.md = md;
    }

    public MethodTreeNode (MethodDefinition md, boolean allowsChildren) {
        super (md.getTitle (), allowsChildren);
        this.md = md;
    }

    @Override
    public void setUserObject (Object userObject) {
        super.setUserObject (((MethodDefinition) userObject).getTitle ());
        this.md = (MethodDefinition) userObject;
    }

    public MethodDefinition getMethodDefinition () {
        return md;
    }
}
